﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PhotoGallery.Model;
using PhotoGallery.DLL;
namespace PhotoGallery.BLL
{
    public class AlbumAction
    {
        AlbumsDataAccess ada = new AlbumsDataAccess();
        /*列出全部相册*/
        public List<Albums> allAlbums() 
        {
            return ada.getAlltheAlbums();
        }
        /*选择某一特定相册*/
        public Albums showAlbum(string aid) 
        { 
            return ada.searchAlbumById(aid);
        }
        /*列出某人的全部相册*/
        public List<Albums> allAlbumsofSomeone(string uid) 
        {   
            return ada.searchAlbumByUid(uid);
        }
        /*列出最新创建的相册，参数为选取前几个相册*/
        public List<Albums> newAlbumList(string top) 
        {
            return ada.searchNewAlbum(top);
        }
        /*根据相册封面取得相册*/
        public Albums getAlbumbyCover(string cover) 
        {
            return ada.searchAlbumbyCover(cover);
        }
        /*新建相册*/
        public Albums newAlbum(String uid, String title, String desp) 
        {
            ada.insert(uid, title, desp);
            return ada.getAlbumByUidndTitle(uid, title);
        }
        /*修改相册信息*/
        public void modifyAlbum(String aid,Albums album) 
        {
            ada.modifyAlbum(aid, album);
        }
        /*初始化相册封面*/
        public void modifyAlbum(String aid, String cover)
        {
            PictureDataAccess pda = new PictureDataAccess();
            pda.setCover(cover, aid);
            ada.modifyAlbum(aid, cover);
        }
        /*删除相册*/
        public void deleteAlbum(String aid) 
        {
            ada.delete(int.Parse(aid));
        }
    }
}
